# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Contributor: Andrew Sun <adsun701 at gmail dot com>
# Contributor: Dmitrij D. Czarkoff <czarkoff at gmail dot com>

pkgname=baresip
pkgver=3.5.1
pkgrel=2
pkgdesc="portable and modular SIP User-Agent with audio and video support"
arch=('loong64' 'x86_64')
url="https://github.com/baresip/baresip"
license=('BSD')
depends=(libre.so openssl)
optdepends=('libfdk-aac: AAC audio codec'
            'alsa-lib: ALSA audio driver'
            'opencore-amr: Adaptive Multi-Rate (AMR) audio codec'
            'aom: (av1 module}'
            'codec2: CODEC2 low-bitrate speech audio codec'
            'ffmpeg: (avcodec, avformat, h265 modules)'
            'gsm: (gsm module)'
            'gst-plugins-bad: (gst1, gst_video1 modules)'
            'gst-plugins-base: (gst1, gst_video1 modules)'
            'gst-plugins-good: (gst1, gst_video1 modules)'
            'gst-plugins-ugly: (gst1, gst_video1 modules)'
            'gtk3: gtk+ user interface'
            'jack2: JACK Audio Connection Kit audio driver'
            'lame: MPA audio codec'
            'libvpx: (vpx module)'
            'libsndfile: (sndfile module)'
            'libpng: Snapshot video module'
            'libpulse: Pulseaudio audio driver'
            'libx11: (x11, x11grab modules)'
            'mpg123: (rst module)'
            'opus: (opus module)'
            'portaudio: Portaudio audio driver'
            'sdl2: (sdl2 module)'
            'spandsp: (g722, g726,plc modules)'
            'speexdsp: (speex_aec, speex_pp modules)'
            'sndio: sndio audio driver'
            'v4l-utils: (v4l2 module)')
makedepends=(${optdepends[@]/%:*/} python cmake)
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/baresip/baresip/archive/v${pkgver}.tar.gz")
sha256sums=('622122edf376145870bc7749af0463c5f04a668b3d095c025b718f1910f1b77b')

build() {
  cd ${pkgname}-${pkgver}
  cmake -B build -DCMAKE_BUILD_TYPE='None' -DCMAKE_INSTALL_PREFIX='/usr' -Wno-dev
  cmake --build build
}

package() {
  cd ${pkgname}-${pkgver}
  DESTDIR="$pkgdir" cmake --install build
  install -vDm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
